CC=gcc
CFLAGS+=-Wall
LIBPATH=../../../../common/c
INCLS=-I$(LIBPATH)/include -I../../src/include
LIBS=-L$(LIBPATH)/lib -lsoar -lcrypto -lpthread -lrt
LIBS_DEBUG=-L$(LIBPATH)/lib -lsoar_g -lcrypto -lpthread -lrt

OBJS=main.o listener.o worker.o monitor.o
BIN=seagent
BIN_DEBUG=seagent_debug

.PHONY : default all debug release clean

default : debug

all : debug release

debug : $(BIN_DEBUG)

$(BIN_DEBUG) : $(OBJS)
	$(CC) $(CFLAGS) $(INCLS) -o $@ $^ $(LIBS_DEBUG)
	chmod 755 $@

$(OBJS) : %.o : %.c
	$(CC) $(CFLAGS) -D_MY_DEBUG -g $(INCLS) -c -o $@ $<

release : $(BIN)

$(BIN) : $(OBJS:%.o=%.c)
#	$(CC) $(CFLAGS) -O3 $(INCLS) -o $@ $^ $(LIBS)
	$(CC) $(CFLAGS) -g $(INCLS) -o $@ $^ $(LIBS_DEBUG)
	chmod 755 $@

clean :
	rm -f core* *.log $(OBJS) $(BIN) $(BIN_DEBUG)
